
 
 F u n c t i o n :   s e t A t t r i b u t e ( d o m E l e m e n t O r N o d e A r r a y O r C S S S e l e c t o r ,   s t r i n g A t t r i b u t e N a m e O r K e y V a l u e M a p ,   v a l u e ) 
 
 
 
 S h o r t h a n d :   s e t A t t r ( d o m E l e m e n t O r N o d e A r r a y O r C S S S e l e c t o r ,   s t r i n g A t t r i b u t e N a m e O r K e y V a l u e M a p ,   v a l u e ) 
 
 
 
 D e s c r i p t i o n :   S e t s   t h e   s p e c i f i e d   a t t r i b u t e s   f o r   a   D O M   e l e m e n t ,   m a r k u p   s t r i n g ,   o r   C S S   s e l e c t o r   r e f e r e n c e d   e l e m e n t . 
 
 
 
 R e t u r n s :   d o m E l e m e n t   o r   m a t c h i n g   n o d e   a r r a y ,   o r   $ A   o b j e c t   i f   c h a i n e d . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   S e t   a n   a t t r i b u t e   o n   a   D O M   e l e m e n t 
 
 v a r   m y E l e m e n t   =   $ A . s e t A t t r i b u t e ( d o m E l e m e n t ,   " t a b i n d e x " ,   0 ) ; 
 
 
 
 / /   S e t   m u l t i p l e   a t t r i b u t e s   o n   a n   a r r a y   o f   D O M   e l e m e n t s 
 
 v a r   m y E l e m e n t s A r r a y   =   $ A . s e t A t t r i b u t e ( [ d o m E l e m e n t 1 ,   d o m E l e m e n t 2 ] ,   { 
 
     t a b i n d e x :   - 1 , 
 
     " a r i a - d i s a b l e d " :   " t r u e " 
 
 } ) ; 
 
 
 
 / /   S e t   m u l t i p l e   a t t r i b u t e s   o n   m u l t i p l e   D O M   e l e m e n t s   r e f e r e n c e d   b y   a   C S S   s e l e c t o r 
 
 v a r   m y E l e m e n t s A r r a y   =   $ A . s e t A t t r i b u t e ( ' # m y L i s t b o x [ r o l e = " l i s t b o x " ]   * [ r o l e = " o p t i o n " ] [ t a b i n d e x ] ' ,   { 
 
     " a r i a - s e l e c t e d " :   " f a l s e " , 
 
     t a b i n d e x :   - 1 
 
 } ) ; 
 
 
 
 / /   O r   t h e   s a m e   u s i n g   c h a i n i n g 
 
 
 
 / /   S e t   a n   a t t r i b u t e   o n   a   D O M   e l e m e n t 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . s e t A t t r i b u t e ( " t a b i n d e x " ,   0 ) ; 
 
 
 
 / /   S e t   m u l t i p l e   a t t r i b u t e s   o n   a n   a r r a y   o f   D O M   e l e m e n t s 
 
 v a r   m y C h a i n   =   $ A ( [ d o m E l e m e n t 1 ,   d o m E l e m e n t 2 ] ) . s e t A t t r i b u t e ( { 
 
     t a b i n d e x :   - 1 , 
 
     " a r i a - d i s a b l e d " :   " t r u e " 
 
 } ) ; 
 
 
 
 / /   S e t   m u l t i p l e   a t t r i b u t e s   o n   m u l t i p l e   D O M   e l e m e n t s   r e f e r e n c e d   b y   a   C S S   s e l e c t o r 
 
 v a r   m y C h a i n   =   $ A ( ' # m y L i s t b o x [ r o l e = " l i s t b o x " ]   * [ r o l e = " o p t i o n " ] [ t a b i n d e x ] ' ) . s e t A t t r i b u t e ( { 
 
     " a r i a - s e l e c t e d " :   " f a l s e " , 
 
     t a b i n d e x :   - 1 
 
 } ) ; 
 
 
 
 / /   T o   r e t u r n   t h e   m o d i f i e d   e l e m e n t   w i t h i n   a   c h a i n ,   u s e   t h e   " r e t u r n ( ) "   m e t h o d . 
 
 
 
 v a r   m y E l e m e n t   =   m y C h a i n . r e t u r n ( ) ; 
 
 